const fs = require('fs')
let configPath = './config.' + process.argv[2].replace('-','') + '.js'
let config = require(fs.existsSync(configPath) ? configPath : './config.js');
let nm = require('./source')
//实体
nm.$.merge(config,require('./entity'))
//初始化
nm.init(config)
//设置路由
require('./router')(nm)
if (process.argv[2] == '-init') {
    require('./init')(nm.models(), process.argv[3])
}else{
    nm.server()
}